//
//  AboutViewController.m
//  Cai8
//
//  Created by zhoubo on 2017/6/19.
//  Copyright © 2017年 zhoubo. All rights reserved.
//

#import "AboutViewController.h"

@interface AboutViewController ()

@property (weak, nonatomic) IBOutlet UIImageView *lotteryImgview;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *heightConstraint;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *margintopCons;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *marginX;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *marginY;


@end

@implementation AboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    // 适配iphone5
    if (ScreenWidth() < 350) {
        self.margintopCons.constant = 50;
        self.marginX.constant = 40;
        self.marginY.constant = 40;
    }
    self.heightConstraint.constant = self.lotteryImgview.frame.size.width;
    self.lotteryImgview.contentMode = UIViewContentModeScaleAspectFit;
    [self viewAnimation:self.lotteryImgview];
    
    self.title = NSLocalizedString(@"关于", nil);

    
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = false;
    
}

-(void)viewWillDisappear:(BOOL)animated
{
    [UIView animateWithDuration:0.3 animations:^{
        self.tabBarController.tabBar.alpha = 1;
    }];
}


-(void)viewAnimation:(UIView*)view
{
    
    [UIView animateWithDuration:2 delay:0 usingSpringWithDamping:0 initialSpringVelocity:0 options:UIViewAnimationOptionLayoutSubviews animations:^{
        view.frame = CGRectMake(ScreenWidth()/2 - 50, 150, 100, 100);
    } completion:nil];
    /* 旋转 */
    
    // 对Y轴进行旋转（指定Z轴的话，就和UIView的动画一样绕中心旋转）
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    
    // 设定动画选项
    animation.duration = 50; // 持续时间
    animation.repeatCount = 1000; // 重复次数
    
    // 设定旋转角度
    animation.fromValue = [NSNumber numberWithFloat:0.0]; // 起始角度
    animation.toValue = [NSNumber numberWithFloat:2 * M_PI]; // 终止角度
    
    // 添加动画
    [view.layer addAnimation:animation forKey:@"rotate-layer"];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
